// @charset "utf-8";
define(function (require, exports, module) {
	var userPath = null;
	var thsPath = null;
	var fis = null;
	var fos = null;
	try {
		userPath = external.getUserPath();
		thsPath = userPath+'ths_customplates\\';
		fis = external.createObject('FileInputStream');
		fos = external.createObject('FileOutputStream');
	} catch (exp) {
		//
	}

	var ClientData = function () {
		this.getFileContent = function (file) {
			if (null === fis) {
				return false;
			}
			var str = false;
			if (fis.open(thsPath+file)) {
				try {
					str = fis.readDes();
				} catch (exp) {
					//
				}

				fis.close();
			}

			if (false === str || '' === str) {
				return false;
			}

			return eval('('+str+')');
		};
		this.writeFileContent = function (file, jsonObj) {
			var str = '';
			if (null === fos) {
				return false;
			}

			if (fos.open(thsPath+file)) {
				try {
					str = fos.writeDes(JSON.stringify(jsonObj));
				} catch (exp) {
					//alert(exp.message);
				}

				fos.close();
			}
		};
	};

	module.exports = new ClientData();
});

